package com.xh.bussiness.exam.dao;

import com.xh.bussiness.exam.bean.ErrorClassStudent;
import com.xh.bussiness.exam.bean.dto.UserErrorQuestionDto;
import com.xh.bussiness.exam.bean.request.StudentErrorTotalStatRequest;
import com.xh.bussiness.exam.bean.request.UserErrorQuestionRequest;
import com.xh.bussiness.exam.bean.dto.KnowledgeDto;
import com.xh.bussiness.exam.model.UserErrorQuestion;
import com.xh.bussiness.tiku.bean.dto.QuestionDto;


import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xh.core.bean.XhPage;
import org.apache.ibatis.annotations.Param;


/**
 * <p>
 * 用户错题本 Mapper 接口
 * </p>
 *
 * @author daiwei
 * @since 2019-02-23
 */
public interface UserErrorQuestionMapper extends BaseMapper<UserErrorQuestion> {

    Integer queryCount(@Param("bean") UserErrorQuestionRequest bean);

    XhPage<UserErrorQuestionDto> queryByParam(@Param("page") XhPage<UserErrorQuestionDto> page, @Param("bean") UserErrorQuestionRequest bean);

    List<Map<String, Object>> queryCountBySubject(@Param("studentId") String studentId);

    /**
     * 错题及订正统计
     *
     * @param bean
     * @return
     */
    List<Map<String, Object>> queryStudentErrorQuestionByGradeTypeAndSubject(StudentErrorTotalStatRequest bean);

    /**
     * 查询学生错题知识点
     *
     * @param studentId
     * @param subjectId
     * @param gradeRange
     * @return
     */
    List<KnowledgeDto> queryStudentErrorQuesKnowledge(@Param("studentId") String studentId, @Param("subjectId") String subjectId, @Param("gradeRange") String gradeRange);

    /**
     * 根据年月日查询错题
     *
     * @param studentId
     * @param year
     * @param month
     * @return
     */
    List<Map<String, Object>> queryCountByCalendar(@Param("studentId") String studentId, @Param("year") Integer year, @Param("month") Integer month);

    /**
     * 根据日期查询错题id
     *
     * @param studentId
     * @param date
     * @return
     */
    XhPage<UserErrorQuestionDto> queryStuErrorQuestionIdByDate(XhPage page, @Param("studentId") String studentId, @Param("date") String date);


    List<Map<String, Object>> queryUserErrorQuestions(@Param("studentId") String studentId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    /**
     * 薄弱知识点分析
     * @param studentId
     * @param startDate
     * @param endDate
     * @return
     */
    List<Map<String, String>> queryUserErrorQuesKnowledge(@Param("studentId") String studentId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    XhPage<UserErrorQuestionDto> queryByPaperId(@Param("page") XhPage<UserErrorQuestionDto> page, @Param("paperId") String paperId,  @Param("studentId") String studentId);

    XhPage<UserErrorQuestionDto> queryErrorQuestion(@Param("page")XhPage page,@Param("bean") UserErrorQuestionRequest bean);
    List<ErrorClassStudent> queryErrorStudent(@Param("bean") UserErrorQuestionRequest bean);
}
